//
// Created by sgyt on 2020/3/5.
// 信号注册

#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

void signHandler(int signal)
{
    printf("sign == [%d]\n",signal);
    sleep(2);
}


int main(int argc,char *argv[])
{
    //绑定处理方法
    struct sigaction sign;
    sign.sa_handler = signHandler;
    sign.sa_flags = 0;
    sigemptyset(&sign.sa_mask);
    sigaddset(&sign.sa_mask,SIGQUIT);

    sigaction(SIGINT,&sign,NULL);
    while(1)
    {
        sleep(1);
    }

    return 0;
}